<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>业务配置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    #parse('/headFiles.html')
	<style type="text/css">
		.layui-form[wid100] .layui-form-label {
			width: 130px;
		}
		.layui-form[wid100] .layui-input-block {
			margin-left: 160px;
		}
	</style>
</head>
<body>
<div class="layui-fluid">
	<div class="layui-form" id="LAY-config-submit" wid100>
		<div class="layui-card">
			<div class="layui-card-body">
				<button class="layui-btn" lay-submit lay-filter="LAY-config-submit">保存</button>
			</div>
		</div>
		<div class="layui-card">
			<div class="layui-card-header">业务配置</div>
			<div class="layui-card-body">
				<div class="layui-row">
					<div class="layui-col-sm4">
						<div class="layui-form-item">
							<label class="layui-form-label">平台服务分成(%)</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" placeholder="请填写数字" name="serviceChargeRatio" value="$!{config.serviceChargeRatio}">
							</div>
						</div>
					</div>
					<div class="layui-col-sm4">
						<div class="layui-form-item">
							<label class="layui-form-label">代理预留金</label>
							<div class="layui-input-block">
								<input type="text" class="layui-input" placeholder="请填写数字" name="reservedFundMoney" value="$!{config.reservedFundStr}">
								<p style="color:#FF5722;">预留金用于订单退款时回滚分成</p>
							</div>
						</div>
					</div>
					<div class="layui-col-sm4">
						<div class="layui-form-item">
							<label class="layui-form-label">是否启用积分</label>
							<div class="layui-input-block">
                                <input type="checkbox" name="canVirtualMoney" lay-skin="switch" lay-text="开启|关闭" value="true" $!{utils.eq($config.canVirtualMoney,true,'checked')}>
                            </div>
						</div>
					</div>
				</div>
			</div><!-- /.layui-card-body -->
		</div>
	</div><!-- /.layui-form -->
</div><!-- /.layui-fluid -->
#parse('/footFiles.html')
<script type="text/javascript">
layui.config({
	base: '$!{webRoot}/layuiadmin/'
}).extend({
	index: 'lib/index'
}).use(['element', 'index', 'form'], function () {
	var $ = layui.$, form = layui.form;

	form.on('submit(LAY-config-submit)', function (data) {
		var field = data.field;
		var profitProportion = field.profitProportion;
		if (profitProportion != null && profitProportion != '') {
			if (isNaN(profitProportion)) {
				layer.msg("税费只能填写数字", {icon: 2});
				return false;
			}
		}
		$.ajax({
			type: "post",
			url: "$!{webRoot}/config/business/update.do",
			data: field,
			dataType: "json",
			success: function (res) {
				if (res.code == 200) {
					layer.msg('保存成功', {icon: 1});
				} else {
					layer.msg(res.msg, {icon: 2});
				}
			}
		});
	});
});
</script>
</body>
</html>